<?
header('Content-type:text/html;charset=utf-8');
 
 
//配置您申请的appkey
$appkey = "03c8c3db9cbfa3f41e69db8156204dc2";
 
 
 
 
//************1.题库接口************
$url = "http://api2.juheapi.com/jztk/query";
$params = array(
      "key" => $appkey,//您申请的appKey
      "subject" => "1",//选择考试科目类型，1：科目1；4：科目4
      "model" => "c1",//驾照类型，可选择参数为：c1,c2,a1,a2,b1,b2；当subject=4时可省略
      "testType" => "rand",//测试类型，rand：随机测试（随机100个题目），order：顺序测试（所选科目全部题目）
);
$paramstring = http_build_query($params);
$content = juhecurl($url,$paramstring);
$result = json_decode($content,true);
if($result){
    if($result['error_code']=='0'){
        print_r($result);
    }else{
        echo $result['error_code'].":".$result['reason'];
    }
}else{
    echo "请求失败";
}
//**************************************************
 
 
 
 
//************2.answer字段对应答案************
$url = "http://api2.juheapi.com/jztk/answers";
$params = array(
      "key" => $appkey,//您申请的appk
);
$paramstring = http_build_query($params);
$content = juhecurl($url,$paramstring);
$result = json_decode($content,true);
if($result){
    if($result['error_code']=='0'){
        print_r($result);
    }else{
        echo $result['error_code'].":".$result['reason'];
    }
}else{
    echo "请求失败";
}
//**************************************************
 
 

?>